package api_test

import (
	"gitee.com/kristas/booting-go/framework"
	"gitee.com/kristas/booting-go/framework/core/statement/types"
	"gitee.com/kristas/booting-go/framework/web/resp"
	"gitee.com/kristas/booting-go/framework/web/rest"
)

func init() {
	framework.Component(new(TestResponseController))
}

type TestResponseController struct {
	types.Controller `group:"/test/resp/returns"`
	json             rest.GET `url:"/json"`
	xml              rest.GET `url:"/xml"`
	yaml             rest.GET `url:"/yaml"`
	text             rest.GET `url:"/text"`
	html             rest.GET `url:"/html"`
}

func (t *TestResponseController) Json() resp.Response {
	return resp.New(data)
}

func (t *TestResponseController) Xml() resp.Response {
	return resp.New(data).ContentType(resp.ContentXMLHeaderValue)
}

func (t *TestResponseController) Yaml() resp.Response {
	return resp.New(data).ContentType(resp.ContentYAMLHeaderValue)
}

func (t *TestResponseController) Text() resp.Response {
	return resp.New(data).ContentType(resp.ContentTextHeaderValue)
}

func (t *TestResponseController) Html() resp.Response {
	return resp.New(data).ContentType(resp.ContentHTMLHeaderValue)
}
